package day10.ext;

import java.util.LinkedHashMap;

public class Demo01 {
    public static void main(String[] args) {
        /*
         * 默认 LinkedHashMap 记录添加顺序
         * 设置 accessOrder = true 则为访问顺序
         */
        LinkedHashMap<String, Integer> map = new LinkedHashMap<>(
                        16, 0.75f, true);
        map.put("Tom",1);
        map.put("Jerry",2);
        map.put("Andy",3);
        map.put("Mac",4);

        System.out.println(map);
        System.out.println(map.get("Andy"));
        System.out.println(map);
        System.out.println(map.get("Tom"));
        System.out.println(map);
    }
}
